import {notNil, and, str}  from '../lib/validate';

export function validateUsername(username: string | null | undefined): string {
  notNil('username was required')
    .then(and(
      str.notEmpty('username cannot be empty'),
      str.notBlank('username cannot be blank')
    ))(username);
  return username!;
}

export function validatePassword(password: string | null | undefined): string {
  notNil('password was required')
    .then(and(
      str.notEmpty('password cannot be empty'),
      str.notBlank('password cannot be blank')
    ))(password);
  return password!;
}